package com.jh.paymentchannel.pojo.enums;

public enum CmQueryPayStatus {
    PAY_FAIL(0, "未支付成功"),
    PAY_SUCCESS(1, "支付成功"),
    PAY_ING(2, "支付中"),
    PAY_CLOSE(3, "订单已关闭");

    final short value;
    final String desc;

    CmQueryPayStatus(int value, String desc) {
        this.value = (short) value;
        this.desc = desc;
    }

    public short getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }

    public static <T extends Number> CmQueryPayStatus of(T n) {
        short val;
        if (n == null || (val = n.shortValue()) < 0) {
            return null;
        }
        for (CmQueryPayStatus payStatus: values()) {
            if (payStatus.getValue() == val)
                return payStatus;
        }
        return null;
    }
}
